//
//  StoryTabBarController.m
//  BabyBedtimeStory
//
//  Created by qianfeng on 15-6-19.
//  Copyright (c) 2015年 张鹏毅. All rights reserved.
//

#import "StoryTabBarController.h"
#import "BaseViewController.h"

@interface StoryTabBarController ()

@end

@implementation StoryTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatTabBar];
}

-(void)creatTabBar{
    NSArray *titles = @[@"首页",@"发现",@"收藏",@"我的节目"];
    NSArray *images = @[@"Home",@"Find",@"De",@"My"];
    NSArray *clsNames = @[@"HomeViewController",@"FoundViewController",@"PlayViewController",@"MyViewController"];
    NSArray *categorys = @[kHome,kSecond,@"",@""];
    NSMutableArray *arr = [[NSMutableArray alloc]init];
    for (NSInteger i = 0; i < clsNames.count; i++) {
        Class cls = NSClassFromString(clsNames[i]);
        BaseViewController *vc = [[cls alloc]init];
        UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
        nav.tabBarItem.image = [[UIImage imageNamed:images[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        nav.tabBarItem.selectedImage = [[UIImage imageNamed:[NSString stringWithFormat:@"%@_selected",images[i]]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        vc.title = titles[i];
        vc.category = categorys[i];
        [arr addObject:nav];
    }
    self.viewControllers = arr;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
